﻿#pragma once
#include<iostream>
#include<stdio.h>
#include<assert.h>
#include"myrbtree.h"
using namespace std;

template<class K, class V>
class Map
{
public:
	struct KoT
	{
		const K& operator()(const pair<K, V>& t)
		{
			return t.first;
		}
	};

	typedef typename RBTree<K, pair<const K, V>, KoT>::Iterator iterator;
	typedef typename RBTree<K, pair<const K, V>, KoT>::ConstIterator const_iterator;

	iterator begin()
	{
		return _tree.Begin();
	}

	iterator end()
	{
		return _tree.End();
	}
	const_iterator begin() const
	{
		return _tree.Begin();
	}
	const_iterator end() const
	{
		return _tree.End();
	}
	pair<iterator, bool> insert(const pair<K, V>& kv)
	{
		return _tree.Insert(kv);
	}
	iterator find(const K& key)
	{
		return _tree.Find(key);
	}

private:
	RBTree<K, pair<const K, V>, KoT> _tree;
};
